// hyb_yl/zhibo/pages/zhibo/zhibo.js
var app = getApp()
var trtcRoomContext;
const TAG_NAME = 'TRTC-ROOM'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    guanzhu_show:false, //点击头像，显示信息详情
    lianmai_show:false, //显示连麦中
    scrollTop: 0,//自动滚动到底部
    msglist:[
      {},
    ],
    bottom:0,
    debug:'',
    item: {
      streamID: 0,
      userID: 0,
      streamType: 0,
      src: '',
      autoplay:'false',
      muteAudio:'',
      muteVideo:'',
      orientation:'vertical',
      objectFit:'',
      enableBackgroundMute:'',
      minCache:'',
      maxCache:'',
      soundMode:'',
      enableRecvMessage:'',
      autoPauseIfNavigate:'',
      autoPauseIfOpenNative:'',

    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  // 
  foucus(e){
    this.setData({
      bottom:e.detail.height
    })
  },
  blur(e){
    this.setData({
      bottom:0
    })
  },
  // 退出直播间
  bindback(e){
    wx.navigateBack()
  },
  // 点击头像，显示信息详情
  bindGuanzhuxx(e){
    console.log(e)
    this.setData({
      guanzhu_show:true
    })
  },
  close_gz(e){
    this.setData({
      guanzhu_show:false
    })
  },
  // 点击关注
  bindGuanzhu(e){
    console.log(e)
    var that = this
    that.setData({
      guanzhu_show:false
    })
  },
  // Ta的主页
  binddetail(e){
    wx.navigateTo({
      // url: 'url',
    })
  },
  // 连麦
  handlePublishAudio(e){
    var that = this
    that.setData({
      lianmai_show:true
    })
    setInterval(()=>{
      that.setData({
        lianmai_show:false
      })
    },1000)
    
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this
    that.setData({
      scrollTop:that.data.msglist.length*300
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    var that = this
    return {
      title:'',
      imageUrl:'',
      path:''
    }
  }
})